﻿//using MessagePack;

//using NATS.Client.Core;

//using System.Buffers;

//namespace Acl.Communication.Nats;

///// <summary>
/////
///// </summary>
//public sealed class MessagePackNatsSerializer : INatsSerializer
//{
//    private readonly MessagePackSerializerOptions? options;

//    /// <summary>
//    ///
//    /// </summary>
//    public static MessagePackNatsSerializer Default { get; } = new MessagePackNatsSerializer();

//    /// <summary>
//    ///
//    /// </summary>
//    /// <param name="options"></param>
//    public MessagePackNatsSerializer(MessagePackSerializerOptions? options = default) => this.options = options;

//    /// <summary>
//    ///
//    /// </summary>
//    /// <typeparam name="T"></typeparam>
//    /// <param name="bufferWriter"></param>
//    /// <param name="value"></param>
//    /// <returns></returns>
//    public int Serialize<T>(ICountableBufferWriter bufferWriter, T? value)
//    {
//        int writtenCount = bufferWriter.WrittenCount;
//        MessagePackSerializer.Serialize(bufferWriter, value, options);
//        return bufferWriter.WrittenCount - writtenCount;
//    }

//    /// <summary>
//    ///
//    /// </summary>
//    /// <typeparam name="T"></typeparam>
//    /// <param name="buffer"></param>
//    /// <returns></returns>
//    public T? Deserialize<T>(in ReadOnlySequence<byte> buffer) => MessagePackSerializer.Deserialize<T>(in buffer, options);

//    /// <summary>
//    ///
//    /// </summary>
//    /// <param name="buffer"></param>
//    /// <param name="type"></param>
//    /// <returns></returns>
//    public object? Deserialize(in ReadOnlySequence<byte> buffer, Type type) => MessagePackSerializer.Deserialize(type, buffer, options);
//}